using UnityEngine;
using System.Collections;

/// \class  gkSpawnClassSequentialSelector
/// \brief  Choose sequentially a class to spawn in a class array
[AddComponentMenu("GK/Engine/Game/Spawn/gkSpawnClassSequentialSelector")]
public class gkSpawnClassSequentialSelector : gkSpawnClassSelector
{
    /// The Class to spawn
    public GameObject[] SpawnClasses;

    /// The last spawned class index
    private int m_iLastSpawnClassIndex = -1;

    /// \brief  Select a class to spawn
    public override GameObject SelectSpawnClass()
    {
	    // Select the next spawn class index
	    m_iLastSpawnClassIndex = (m_iLastSpawnClassIndex + 1) % SpawnClasses.Length;

	    return SpawnClasses[m_iLastSpawnClassIndex];
    }
}
